home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / clockl.zip / VBCLOCK.FRM (.txt) < prev    next >
Visual Basic Form  |  1992-12-16  |  10KB  |  207 lines

  1. VBClockForm
  2. Title Bar Clock
  3. Arial
  4. Form1
  5. Timer1
  6. Label2
  7. Label2
  8. Arial
  9. Label1
  10. Label 1
  11. Arial
  12. Form1t
  13.     Form_Load
  14. Timer1_TimerT
  15. GetFocus
  16. GetActiveWindow
  17. GetWindowText
  18. lpString
  19. OldWinText
  20. OldText=
  21. NewText
  22. SetWindowText
  23. Handle.
  24.     OldHandle
  25. WindowState
  26. IsIconic
  27. FixTitle
  28. WinHand
  29. NoTime
  30. UseTime@
  31. DisplayTime
  32. NexText
  33. Form_Paint
  34. Form_MouseUp
  35. Button
  36. Shift]
  37. Form_Resize
  38. Visible
  39.     GetParent
  40. IsWindowVisible
  41.     OldString
  42. OldStri
  43. OldHand
  44. COLOR_BACKGROUNDg
  45. BackGroundColor=
  46.     BackColor
  47. IsWindow
  48. ParentHandle<
  49. TempVarc
  50. Parenth
  51. ShowTime}
  52. Captiono
  53. Label1_Click3
  54. Label1+
  55. Width#
  56. Height{
  57.     FalseThen3
  58. GetWindowTextLength
  59. SendMessage
  60. wParam
  61. lParam
  62. WM_SETTEXT
  63. NewMess2
  64. IsWindowEnabled
  65. AndIfO
  66. ThenSetWindowText
  67.     FakeSpaceL
  68. SpacerA
  69. SpacerAs
  70.     OldParent
  71. WindHand
  72. GetClassName
  73. lpClassName
  74.     nMaxCount
  75. Class
  76. FindWindow
  77. CName
  78. wHandle
  79. wwHandle
  80. OldwHandle
  81. Label2
  82. Lable2
  83. GetLastActivePopup
  84. hwndOwnder<
  85. GetWindowWord
  86. nIndex
  87. GWW_HINSTANCE]
  88. GetModuleFileName
  89. hModule
  90. lpFilename
  91. nSizer
  92. VBEnv
  93. Label3
  94. Label2_Click
  95. OldProgenitord
  96. OldWinHand
  97. Progenitor
  98. WinGetActive
  99.     OldActive
  100.     OldTarget
  101. Kernel
  102. FixTitle
  103. not spacebar, but alt-160r
  104.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  105.  FixTitle takes two parameters--the title of the
  106.  window, and a true/false flag indicating 
  107.  whether it should display the current
  108.  time in the window's titlet
  109.  begin by calling DoEvents() to let other apps do their*
  110.  thing--displaying the time is a low priority item.h
  111.  then try to get the handle of the active window's parent window.*
  112.  if it has one thene
  113.  if the parent is visible and it has a caption, set WinHand% to the
  114.  parent's handle
  115.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  116.  X = DoEvents() 
  117. Get the Patriarch if any
  118. Kludge for VB Dev environmentt
  119. Substite top editor window for
  120. hidden partriarcho
  121. tried looking for classname/but same for compiled and runtimet
  122. wndclass_desked_gsk
  123. VB.EXE
  124. If there is a parent and it has a caption and its window is visible then make it the target window
  125.  If Progenitor% = OldProgenitor% And GetActiveWindow() = OldActive% Then
  126.  Debug.Print OldWinHand%, OldActive%
  127.  Exit Sub 
  128.  Else
  129.  OldActive% = GetActiveWindow()o
  130.  End If
  131. If OldWinHand% = GetActiveWindow() Then Exit Sub
  132. OldWinHand% = wHandle%
  133. nd Iff
  134.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  135.  next, get the caption of the active window (or its parent)*
  136.  if it doesn't have one, exit the subw
  137.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  138.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  139.  otherwise, strip off the null character (CHR$(0) from the end of the 
  140.  fixed length string that contains the caption
  141.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  142.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  143.  now set the new caption equal to the old caption*
  144.  and look to see if the new caption contains a FakeSpace$ 
  145.  (the FakeSpace$ is used to proceding the time display)e
  146.  and if so, strip off the time
  147.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  148.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  149.  next strip off any extra spaces from the new caption string
  150.  and, if ShowTime% is True, add the time and date to the new caption stringp
  151.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  152. Short Date
  153. hh:mm am/pm
  154.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  155.  finally, if the window handle is still valid, and the window is visible, 
  156.  and the new caption isn't the same as the old caption
  157.  set the window's title to the new caption
  158.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  159. Form_Load
  160.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  161.    *   as VB Clock loads
  162.    *   first set the caption on Label1 to display the current time,*
  163.    *   then minimize the VB Clock window
  164.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  165. Short Date
  166. hh:mm:ss am/pm
  167. Copyright 
  168.  1992 Paul Bonner
  169. Form_Resize
  170.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  171.    *   whenever the form is resized,
  172.    *   center the label that displays
  173.    *   the current time 
  174.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  175. Timer1_Timer
  176. Static wHandle%%
  177. Static OldTarget%e
  178.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  179.  begin by getting the*
  180.  the handle of the active window.*
  181.  if it has changed since the last timer event*
  182.  call Fixtitle, telling it to remove the time from the old active window.*
  183.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  184. OldWinHand=old active window
  185. OldTarget%=previous target
  186. 'OldTarget% Then
  187.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  188.  next, check to see whether VB Clock is minimized*
  189.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  190. minimizedm
  191.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  192.  if  VB Clock is minimized  
  193.  check to see if the active window is iconic
  194.  if so, exit
  195.  otherwise, call FixTitle again, telling it to display the
  196.  time in the active window's title bar
  197.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  198. not minimized 
  199.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  200.  if  VB Clock is not minimized,*
  201.  update the caption for Label1 on the VB Clock form 
  202.  to display the current time
  203.    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  204. OldTarget% ThenT
  205. Short Date
  206. hh:mm:ss am/pm
  207.